import QtQuick
import QtQuick.Controls
Item {
    id: extraParameterWindow
    width: 1900
    height: 920

    Component.onCompleted: {
        Cpp_PLC.enter_Extra_Axis_Window();
    }


    property real rectangleCount: 9
    property real firstRectWidth: 230
    property real remainingWidth : width-firstRectWidth
    property real otherRectWidth: remainingWidth /(rectangleCount-1)
    property real labelFontSize: 30
    property string labelColor: "aqua"

    Rectangle{
        anchors.fill: parent
        radius: 5
        // //border.width: 1
        // border.color: "black"
        color: "#87CEEB"

    }

    NumberKeyboard{
        id: idlerAxisKeyboard
        isDirectOverwrite: false
    }


    // 水平排列所有矩形
    Row {
        id: rowLayout
        width: parent.width
        height: parent.height
        // spacing: spacing  // 应用间距

        // 第一个矩形（固定宽度）
        Rectangle {
            id: paramaterNameList
            width: firstRectWidth
            height: parent.height
            color: "transparent"
            // border.color: "#555"
            //border.width: 1
            radius: 5

            Column{
                anchors.top: parent.top
                anchors.topMargin: 50
                anchors.horizontalCenter: parent.horizontalCenter
                spacing: 5

                Rectangle{
                    width: 220;height: 50;color: "transparent";
                    Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                        text: qsTr("每转脉冲数");}
                }
                Rectangle{
                    width: 220;height: 50;color: "transparent";
                    Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                        text: qsTr("减速比");}
                }
                Rectangle{
                    width: 220;height: 50;color: "transparent";
                    Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                        text: qsTr("每转位移量");}
                }
                // Rectangle{
                //     width: 220;height: 50;color: "transparent";
                //     Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                //         text: qsTr("零点位置");}
                // }
                // Rectangle{
                //     width: 220;height: 50;color: "transparent";
                //     Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                //         text: qsTr("零点补偿");}
                // }
                Rectangle{
                    width: 220;height: 50;color: "transparent";
                    Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                        text: qsTr("加速时间");}
                }
                Rectangle{
                    width: 220;height: 50;color: "transparent";
                    Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                        text: qsTr("减速时间");}
                }
                Rectangle{
                    width: 220;height: 50;color: "transparent";
                    Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                        text: qsTr("正极限");}
                }
                Rectangle{
                    width: 220;height: 50;color: "transparent";
                    Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                        text: qsTr("负极限");}
                }
                Rectangle{
                    width: 220;height: 50;color: "transparent";
                    Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                        text: qsTr("手动低速");}
                }
                Rectangle{
                    width: 220;height: 50;color: "transparent";
                    Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                        text: qsTr("手动高速");}
                }
                Rectangle{
                    width: 220;height: 50;color: "transparent";
                    Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                        text: qsTr("自动速度");}
                }
                // Rectangle{
                //     width: 220;height: 50;color: "transparent";
                //     Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                //         text: qsTr("实时速度");}
                // }

            }

        }

        // 第二个矩形
        Rectangle {
            width: otherRectWidth
            height: parent.height
            color: "transparent"
            // border.color: "#555"
            //border.width: 1
            radius: 5

            Rectangle{
                width: 160;height: 50;color: "transparent";
                anchors.horizontalCenter: parent.horizontalCenter
                anchors.top: parent.top
                Text{anchors.centerIn: parent;font.pixelSize: labelFontSize;color: "black";
                    text: qsTr("压 辊");}
            }

            Column{
                anchors.top: parent.top
                anchors.topMargin: 50
                anchors.horizontalCenter: parent.horizontalCenter
                spacing: 5

                NumberInput{        // 压辊_每转脉冲数
                    inputWidth:  180
                    inputHeight: 50
                    keyboard: idlerAxisKeyboard
                    text: Cpp_PLC.Idler_PPR
                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_tcp_Hold32(5400,value);
                    }
                }
                NumberInput{        // 压辊_减速比
                    inputWidth:  180
                    inputHeight: 50
                    keyboard: idlerAxisKeyboard
                    text: Cpp_PLC.Idler_RR
                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_tcp_Hold32(5404,value);
                    }
                }
                NumberInput{        // 压辊_每转位移量
                    inputWidth:  180
                    inputHeight: 50
                    keyboard: idlerAxisKeyboard
                    text: Cpp_PLC.Idler_DPR
                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_tcp_Hold32(5408,value);
                    }
                }
                // NumberInput{        // 压辊_零点位置
                //     inputWidth:  180
                //     inputHeight: 50
                //     keyboard: idlerAxisKeyboard
                //     text: Cpp_PLC.Idler_ZP
                //     onEditingFinished: function(value){
                //         Cpp_PLC.write_into_tcp_Hold32(5412,value);
                //     }
                // }
                // NumberInput{        // 压辊_零点补偿
                //     inputWidth:  180
                //     inputHeight: 50
                //     keyboard: idlerAxisKeyboard
                //     text: Cpp_PLC.Idler_ZOC
                //     onEditingFinished: function(value){
                //         Cpp_PLC.write_into_tcp_Hold32(5416,value);
                //     }
                // }
                NumberInput{        // 压辊_加速时间
                    inputWidth:  180
                    inputHeight: 50
                    keyboard: idlerAxisKeyboard
                    text: Cpp_PLC.Idler_T_Acc
                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_tcp_Hold32(5420,value);
                    }
                }
                NumberInput{        // 压辊_减速时间
                    inputWidth:  180
                    inputHeight: 50
                    keyboard: idlerAxisKeyboard
                    text: Cpp_PLC.Idler_T_Dec
                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_tcp_Hold32(5424,value);
                    }
                }
                NumberInput{        // 压辊_正极限
                    inputWidth:  180
                    inputHeight: 50
                    keyboard: idlerAxisKeyboard
                    text: Cpp_PLC.Idler_PL
                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_tcp_Hold32(5428,value);
                    }
                }
                NumberInput{        // 压辊_负极限
                    inputWidth:  180
                    inputHeight: 50
                    keyboard: idlerAxisKeyboard
                    text: Cpp_PLC.Idler_NL
                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_tcp_Hold32(5432,value);
                    }
                }
                NumberInput{        // 压辊_手动低速
                    inputWidth:  180
                    inputHeight: 50
                    keyboard: idlerAxisKeyboard
                    text: Cpp_PLC.Idler_MLS
                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_tcp_Hold32(5452,value);
                    }
                }
                NumberInput{        // 压辊_手动高速
                    inputWidth:  180
                    inputHeight: 50
                    keyboard: idlerAxisKeyboard
                    text: Cpp_PLC.Idler_MHS
                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_tcp_Hold32(5456,value);
                    }
                }
                NumberInput{        // 压辊_自动速度
                    inputWidth:  180
                    inputHeight: 50
                    keyboard: idlerAxisKeyboard
                    text: Cpp_PLC.Idler_AS
                    onEditingFinished: function(value){
                        Cpp_PLC.write_into_tcp_Hold32(5460,value);
                    }
                }
                // NumberInput{        // 压辊_实时速度
                //     inputWidth:  180
                //     inputHeight: 50
                //     keyboard: idlerAxisKeyboard
                //     text: Cpp_PLC.Idler_RTS
                //     onEditingFinished: function(value){
                //         Cpp_PLC.write_into_tcp_Hold32(5464,value);
                //     }
                // }
            }

        }

    }

}
